﻿@{
    Layout = null;
    DeliveryManage.Models.ReturnMsgModel returnMsg = ViewBag.ReturnMsgModel;
}
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>业绩提成规则设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <link rel="stylesheet" href="~/Content/font.css">
    <link rel="stylesheet" href="~/Content/framemain.css">
    <link rel="stylesheet" href="~/Content/pagination.css" />
    <script type="text/javascript" src="~/Content/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="~/Scripts/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="~/Scripts/common.js"></script>
    <script type="text/javascript" src="~/Scripts/framemain.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
    <style>
        .layui-table img {
            max-width: inherit;
        }

        .pro-img {
            border-radius: 5px;
            border: 1px solid #f2f2f2;
        }
    </style>
</head>
<body>
    @using (Html.BeginForm("SalaryCalcFuncation", "System", FormMethod.Get))
    {
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="javascript:;">首页</a>
                <a><cite>业绩提成规则设置</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        if (returnMsg.code == 200)
        {
            <div class="layui-fluid">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md12">
                        <div class="layui-card layui-form">
                            <div class="layui-card-header">
                                <a class="layui-btn" onclick="xadmin.open('添加新规则','/System/SalaryRulesAdd?action=Add',800,600)"><i class="layui-icon">&#xe61f;</i>添加新规则</a>
                            </div>
                            <div class="layui-card-body ">
                                <table class="layui-table layui-form">
                                    <thead>
                                        <tr>
                                            <th>规则名称</th>
                                            <th>提成区间(下限＜A≤上限)</th>
                                            <th>提成比例(%)</th>
                                            <th>适配员工</th>
                                            <th>是否启用</th>
                                            <th width="10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @{
                                            if (ViewBag.RulesList.Count > 0)
                                            {
                                                List<DeliveryManage.Model.Sys_PerformanceRules> list = ViewBag.RulesList;
                                                for (int i = 0; i < list.Count; i++)
                                                {
                                                    DeliveryManage.Model.Sys_PerformanceRules item = list[i];
                                                    List<DeliveryManage.Model.Sys_PerformanceRules> singleList = list.Where(p => p.Name == list[i].Name).ToList();
                                                    <tr>
                                                        <td rowspan="@singleList.Count">@item.Name</td>
                                                        <td>@(item.MinLimit <= 0 ? item.MaxLimit+" 及以下": item.MinLimit +" - "+ item.MaxLimit)</td>
                                                        <td>@item.CommRatio</td>
                                                        <td rowspan="@singleList.Count">@(item.ToType==1?"有底薪":"无底薪")</td>
                                                        <td rowspan="@singleList.Count">@(item.IsEnlabe?"启用":"关闭")</td>
                                                        <td rowspan="@singleList.Count">
                                                            <div class="layui-btn-container">
                                                                <a title="编辑规则" class="layui-btn layui-btn-xs" onclick="xadmin.open('编辑规则','/System/SalaryRulesAdd?action=Edit&name=@item.Name',800,600)" href="javascript:;"><i class="layui-icon">&#xe642;</i>编辑</a>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    for (int j = 1; j < singleList.Count; j++)
                                                    {
                                                        <tr>
                                                            <td>@singleList[j].MinLimit @(singleList[j].MaxLimit == 0 ? "及以上" : "- " + singleList[j].MaxLimit)</td>
                                                            <td>@singleList[j].CommRatio</td>
                                                        </tr>
                                                        i++;
                                                    }

                                                }
                                            }
                                            else
                                            {
                                                <tr>
                                                    <td colspan="6" align="center" height="200"><img src="~/images/nodata.png" style=" width: 10%; " /><br /> 暂无相关数据</td>
                                                </tr>
                                            }
                                        }

                                    </tbody>
                                    </table>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        }
    }

    <script type="text/javascript">
    layui.use(['laydate', 'form'], function () {
        var laydate = layui.laydate;
        var form = layui.form;
    });

      $(function () {
            //操作提示
            if (@returnMsg.code == 400) {
                layer.msg('@returnMsg.msg', { icon: 5, title: '提示' }, function (index) {
                  layer.close();
                })
            }
        })
    </script>
</body>
</html>
